home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
ICNDRW_1.ARJ
/
ANIMAT.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-08-16
|
2KB
|
87 lines
{--------------------------------------------------------------------------
Copyright (c) 1991 SofDesign Technology
All Rights Reserved
An animation program that uses icons
as frames. You must specify a library name
that contains a series of icons, or frames,
if you prefer.
--------------------------------------------------------------------------}
{$X+}
{$G+}
{$R-}
{$S-}
Program icon_animator;
uses crt,icontool,libtools,bgidriv,graph;
const
maxframes = 100;
var
movie : array[1..maxframes] of icon;
num : word;
frames : array[1..maxframes] of string[12];
{$I grafinit.pas}
procedure main;
var i:integer;
f:file;
h:header_type;
ir : icon_record;
p:pointer;
k:char;
newx,newy :integer;
begin
num:=getnumicons(paramstr(1));
if num>0 then
begin
assign(f,paramstr(1));
reset(f,1);
readheader(f,h);
for i:=1 to num do
begin
blockread(f,ir,sizeof(ir));
frames[i]:=ir.fname;
getmem(p,ir.size);
blockread(f,p^,ir.size);
freemem(p,ir.size);
end;
close(f);
for i:=1 to num do
begin
movie[i].init(paramstr(1),frames[i],getmaxx div 2, getmaxy div 2);
movie[i].setput(copyput);
movie[i].icontitle(false);
end;
i:=0;
k:=' ';
randomize;
while k<>#27 do
begin
inc(i);
if keypressed then
k:=readkey;
if i>num then
begin
newx:=random(getmaxx - 50)+1;
newy:=random(getmaxy - 50)+1;
for i:=1 to num do
movie[i].setxy(newx,newy);
cleardevice;
i:=1;
end;
movie[i].display_icon;
delay(50);
end;
end;
closegraph;
end;
begin
grafinit;
main;
end.